
import Login from './userGreeting'
import Guest from './guestGreeting'
import {Component} from 'react'

export default class extends Component{
      
      state={
        isLogin:false
      }

       handleLogin=()=>{
        this.setState({
            isLogin:true
        })
       }

       handleSign=()=>{
        this.setState({
            isLogin:false
        })
       }

    render(){
        return(
            <>
            {this.state.isLogin?<Login/>:<Guest/>}
            <button onClick={this.handleLogin}>登录</button>
            <button onClick={this.handleSign}>注销</button>
            </>
        )         
    }

    
}